class NumberShortener:
    # 自定义字符集，按顺序排列并排除容易混淆的字符
    CHARSET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    BASE = len(CHARSET)

    @staticmethod
    def encode(number):
        if number == 0:
            return NumberShortener.CHARSET[0]  # 处理数字 0 的情况

        sb = []
        while number > 0:
            sb.append(NumberShortener.CHARSET[number % NumberShortener.BASE])
            number //= NumberShortener.BASE
        return ''.join(reversed(sb))

    @staticmethod
    def decode(short_string):
        number = 0
        for char in short_string:
            number = number * NumberShortener.BASE + NumberShortener.CHARSET.index(char)
        return number

if __name__ == "__main__":
    original_number = 60

    shortened = NumberShortener.encode(original_number)
    decoded_number = NumberShortener.decode(shortened)
    print("Shortened string:", shortened)
    print("Decoded number:", decoded_number)
